#define  _CRT_SECURE_NO_WARNINGS 1

#include"string.h"

void TestString1()
{
	zhh::string s1("hello world");
	zhh::string::iterator it = s1.begin();
	while (it != s1.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;
	{
	for (auto ch : s1)
		cout << ch << "6";
	}
	cout << endl;
}

void TestString2()
{
	zhh::string s1("hello world");

	s1.push_back('#');
	cout << s1.c_str() << endl;

	s1.append(" good moning");
	cout << s1.c_str() << endl;

	s1 += '*';
	cout << s1.c_str() << endl;

	s1 += " six";
	cout << s1.c_str() << endl;

	s1.clear();
	cout << s1.c_str() << endl;

	zhh::string s2("hanbaoya886");

	s2.resize(20,'x');
	cout << s2.c_str() << endl;

	s2.reserve(100);
	cout << s2.capacity() << endl;

	s2.swap(s1);
}

void TestString3()
{
	zhh::string s1("abc");
	zhh::string s2("efg");
	/*cout << (s1 < s2) << endl;
	cout << (s1 > s2) << endl;*/
}

void TestString4()
{
	zhh::string s1("hello");
	zhh::string s2("hello");
	cout << (s1 < s2) << endl;
	cout << (s1 > s2) << endl;
	cout << (s1 == s2) << endl << endl;


	zhh::string s3("hello");
	zhh::string s4("helloxxx");
	cout << (s3 < s4) << endl;
	cout << (s3 > s4) << endl;
	cout << (s3 == s4) << endl << endl;


	zhh::string s5("helloxxx");
	zhh::string s6("hello");
	cout << (s5 < s6) << endl;
	cout << (s5 > s6) << endl;
	cout << (s5 == s6) << endl << endl;
}

void TestString5()
{
	zhh::string s1("hello world");

	zhh::string Sub = s1.substr(2, 6);
	cout << Sub.c_str() << endl;
}

void TestString6()
{
	zhh::string s1("hello world");

	cout << s1 << endl;
	cin >> s1;
	cout << s1 << endl;
}

void TestString7()
{
	zhh::string s1("hello world");
	zhh::string s2("my world");

	s1 = s2;
	cout << s1 << endl;
}

void TestString8()
{
	zhh::string s1("hello world");
	s1.insert(0, 'p');
	cout << s1 << endl;
}

int main()
{
	TestString8();
	return 0;
}